//
//  LoginViewController.m
//  豆瓣电影
//
//  Created by dllo on 16/6/23.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "LoginViewController.h"
#import "ShowView.h"
#import "RegisterViewController.h"

@interface LoginViewController ()

@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self config];
    
    [self createSubViews];

}

-(void)config
{
    self.navigationItem.title = @"用户登录";
    
//    self.navigationController.navigationBarHidden = YES;
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:0.93 green:0.93 blue:0.93 alpha:1.0];
}

-(void)createSubViews
{
    NSArray *labelArray = @[@"用户名", @"密码"];
    NSArray *textArray = @[@"请输入账户名", @"请输入密码"];
    
    for (int i = 0; i < 2; i++) {
        ShowView *showView = [[ShowView alloc]initWithFrame:CGRectMake(80, 200 + i * 60, 250, 50)];
        [self.view addSubview:showView];
        
        showView.textLabel.text = labelArray[i];
        showView.textField.placeholder = textArray[i];
        
        [showView release];
    }
    
    /**loginButton*/
    
    UIButton *loginButton = [UIButton buttonWithType:UIButtonTypeCustom];
    
    [loginButton setTitle:@"登录" forState:UIControlStateNormal];
    
    loginButton.frame = CGRectMake(80, 320, 100, 30);
    
    loginButton.backgroundColor = [UIColor colorWithRed:0.65 green:0.78 blue:0.34 alpha:1.0];
    
    [self.view addSubview:loginButton];
    
    [loginButton addTarget:self action:@selector(loginButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    
    [loginButton release];
    
    /**registerButton*/
    UIButton *registerButton = [UIButton buttonWithType:UIButtonTypeCustom];
    
    [registerButton setTitle:@"注册" forState:UIControlStateNormal];
    
    registerButton.frame = CGRectMake(220, 320, 100, 30);
    
    registerButton.backgroundColor = [UIColor colorWithRed:0.91 green:0.59 blue:0.27 alpha:1.0];
    
    [self.view addSubview:registerButton];
    
    [registerButton addTarget:self action:@selector(registerButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    
    [registerButton release];
    
}

/**registerButton事件*/
-(void)registerButtonAction:(UIButton *)button
{
    RegisterViewController *registerVC = [[RegisterViewController alloc]init];
    
    [self.navigationController pushViewController:registerVC animated:YES];
}

/**loginButton事件*/
-(void)loginButtonAction:(UIButton *)button
{
    
}



@end









